API Documentation
Vector.h
1 // Vector.h
3 //
5 
6 namespace nkMaths
7 {
11  class DLL_GRAPHICS_EXPORT Vector : public ByteAlignedClass<16>
12  {
13  public :
14 
18  Vector () ;
25  Vector (float x, float y) ;
33  Vector (float x, float y, float z) ;
42  Vector (float x, float y, float z, float w) ;
48  Vector (const Vector& other) ;
54  Vector (const IVector& other) ;
60  Vector (const DirectX::XMVECTOR& value) ;
64  ~Vector () ;
65 
69  float getX () const ;
73  float getY () const ;
77  float getZ () const ;
81  float getW () const ;
87  DirectX::XMVECTOR getValues () const ;
88 
89  // Setters
95  void setX (float value) ;
101  void setY (float value) ;
107  void setZ (float value) ;
113  void setW (float value) ;
114 
115  // Add
121  void addX (float value) ;
127  void addY (float value) ;
133  void addZ (float value) ;
139  void addW (float value) ;
145  void multX (float value) ;
151  void multY (float value) ;
157  void multZ (float value) ;
163  void multW (float value) ;
164 
168  void normalizeAsVec2 () ;
176  void normalizeAsVec3 () ;
184  void normalizeAsVec4 () ;
189  // Dot product
196  float dotProductAsVec2 (const Vector& other) const ;
203  float dotProductAsVec3 (const Vector& other) const ;
210  float dotProductAsVec4 (const Vector& other) const ;
211  // Cross product
217  void setAsCrossVec2 (const Vector& other) ;
224  Vector getCrossVec2 (const Vector& other) ;
230  void setAsCrossVec3 (const Vector& other) ;
237  Vector getCrossVec3 (const Vector& other) const ;
244  void setAsCrossVec4 (const Vector& other1, const Vector& other2) ;
252  Vector getCrossVec4 (const Vector& other1, const Vector& other2) const ;
253  // Distances
257  float getLength () const ;
261  float getLengthSquared () const ;
266  float getDistanceSquared (const Vector& other) const ;
271  float getDistance (const Vector& other) const ;
272 
273  // Pratique
280  void fromString (const std::string_view& str) ;
281 
282  // Operators
289  Vector& operator= (const Vector& other) ;
296  Vector& operator= (const IVector& other) ;
303  Vector operator+ (const Vector& other) const ;
309  void operator+= (const Vector& other) ;
316  Vector operator- (const Vector& other) const ;
322  void operator-= (const Vector& other) ;
329  Vector operator* (const Vector& other) const ;
335  void operator*= (const Vector& other) ;
342  Vector operator* (const Quaternion& other) const ;
348  void operator*= (const Quaternion& other) ;
355  Vector operator* (const Matrix& mat) const ;
361  void operator*= (const Matrix& other) ;
368  Vector operator* (float coeff) const ;
374  void operator*= (float coeff) ;
381  Vector operator/ (const Vector& other) const ;
387  void operator/= (const Vector& other) ;
394  Vector operator/ (float coeff) const ;
400  void operator/= (float coeff) ;
407  bool operator== (const Vector& other) const ;
414  bool operator!= (const Vector& other) const ;
421  bool operator< (const Vector& other) const ;
428  bool operator<= (const Vector& other) const ;
435  bool operator> (const Vector& other) const ;
442  bool operator>= (const Vector& other) const ;
443  } ;
444 }
nkMaths::Vector::getZ
float getZ() const
nkMaths::Vector::Vector
Vector(float x, float y, float z, float w)
nkMaths::Vector::getY
float getY() const
nkMaths::Vector::setAsCrossVec3
void setAsCrossVec3(const Vector &other)
nkMaths::Vector::getCrossVec3
Vector getCrossVec3(const Vector &other) const
nkMaths
Encompasses all API of component NilkinsMaths.
Definition: IVector.h:7
nkMaths::Vector::getNormalizedAsVec4
Vector getNormalizedAsVec4() const
nkMaths::Quaternion
A quaternion, symbolizing rotations as a 4D vector.
Definition: Quaternion.h:12
nkMaths::Vector::normalizeAsVec2
void normalizeAsVec2()
nkMaths::Vector::getW
float getW() const
nkMaths::Vector::multY
void multY(float value)
nkMaths::Vector::getNormalizedAsVec2
Vector getNormalizedAsVec2() const
nkMaths::Vector::setZ
void setZ(float value)
nkMaths::Matrix
Represents a 4x4 float matrix.
Definition: Matrix.h:12
nkMaths::Vector::getCrossVec2
Vector getCrossVec2(const Vector &other)
nkMaths::Vector::getDistanceSquared
float getDistanceSquared(const Vector &other) const
nkMaths::Vector::getCrossVec4
Vector getCrossVec4(const Vector &other1, const Vector &other2) const
nkMaths::Vector::Vector
Vector()
nkMaths::Vector::setY
void setY(float value)
nkMaths::Vector::addZ
void addZ(float value)
nkMaths::Vector::multW
void multW(float value)
nkMaths::Vector::Vector
Vector(const DirectX::XMVECTOR &value)
nkMaths::Vector::getNormalizedAsVec3
Vector getNormalizedAsVec3() const
nkMaths::Vector::setW
void setW(float value)
nkMaths::Vector::Vector
Vector(const Vector &other)
nkMaths::Vector::multX
void multX(float value)
nkMaths::Vector::~Vector
~Vector()
nkMaths::Vector::setX
void setX(float value)
nkMaths::Vector::addX
void addX(float value)
nkMaths::Vector::addY
void addY(float value)
nkMaths::Vector::getLengthSquared
float getLengthSquared() const
nkMaths::Vector::dotProductAsVec2
float dotProductAsVec2(const Vector &other) const
nkMaths::Vector::getDistance
float getDistance(const Vector &other) const
nkMaths::IVector
A 4-component vector class, with integers.
Definition: IVector.h:12
nkMaths::Vector::Vector
Vector(float x, float y)
nkMaths::Vector::fromString
void fromString(const std::string_view &str)
nkMaths::Vector::normalizeAsVec3
void normalizeAsVec3()
nkMaths::Vector::getLength
float getLength() const
nkMaths::Vector::Vector
Vector(const IVector &other)
nkMaths::Vector::multZ
void multZ(float value)
nkMaths::Vector::addW
void addW(float value)
nkMaths::Vector::getX
float getX() const
nkMaths::Vector::dotProductAsVec3
float dotProductAsVec3(const Vector &other) const
nkMaths::Vector::normalizeAsVec4
void normalizeAsVec4()
nkMaths::Vector::Vector
Vector(float x, float y, float z)
nkMaths::Vector
A 4-component vector class, with floats.
Definition: Vector.h:12
nkMaths::Vector::setAsCrossVec4
void setAsCrossVec4(const Vector &other1, const Vector &other2)
nkMaths::Vector::getValues
DirectX::XMVECTOR getValues() const
nkMaths::Vector::dotProductAsVec4
float dotProductAsVec4(const Vector &other) const
nkMaths::Vector::setAsCrossVec2
void setAsCrossVec2(const Vector &other)